﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Phones.Models;
using System.Linq.Expressions;

namespace Phones.DataLayer
{
    public class TreeElementRepository : BaseRepository
    {
        public TreeElementRepository() : base() { }

        public TreeElementRepository(PhonesEntities context) : base(context) { }

        public TreeElement GetRoot()
        {
            TreeElement item = Context.TreeElements.FirstOrDefault(x => x.Parent == null);
            return item;
        }

        public List<TreeElement> GetList()
        {
            var list = new List<TreeElement>();
            list = Context.TreeElements.ToList();
            return list;
        }
    }
}
